#pragma once
#ifndef __UTIL_H
#define __UTIL_H
/**
 * \file util.h
 * \brief contains utility definitions
 * \author Mohamad Noureddine
 * \date 30-06-2011
 */

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <list>
#include <assert.h>
#include "PDTNode.h"
#include "PDTGraphVisitor.h"
#include "PDTNumVar.h"
#include "PDTExpBoolBinNumDerived.h"
#include "PDTExpNumBinDerived.h"
#include "PDTProp.h"
#include "PDTCodeGraph.h"
#include "PDTNumConst.h"
#include "PDTAssign.h"
#include "PDTBoolVar.h"
#include "PDTExpBoolBinBoolDerived.h"
#include "PDTSetOp.h"
#include "PDTIfElse.h"
#include "PDTAssert.h"
#include "PDTListOfStatements.h"
#include "PDTType.h"
#include "PDTSetVar.h"
#include "PDTQuantifier.h"
#include "PDTBoolConst.h"
#include "PDTNeg.h"
#include "PDTNot.h"
#include "PDTWhile.h"
#include "CGTranslate2SC.h"
#include "PDTSequenceOp.h"
#include "PDTFunction.h"
#include "PDTSequenceVar.h"
#include "PDTBehavior.h"
#include "PDTAssignment.h"
#include "PDTExp.h"
#include "PDTVecConst.h"
#include "PDTAntlrProperties.h"

using namespace std;

/*
 Enum for types when constructing the Code Graph from TINY
 */ 
enum CGTypeEnum {
    CGINT,                  //!< integer type
    CGBOOL,                 //!< boolean type
    CGINTARRAY,             //!< integer array type
    CGBOOLARRAY             //!< boolean array type
};

/*
 Enum for function return types
 */
enum CGFuncReturn {
    FuncInt,     //!< integer return type
    FuncBool,    //!< boolean return type
    FuncVoid     //!< void return
};

typedef enum CGTypeEnum CGTypeEnum_t;
typedef enum CGFuncReturn CGFuncReturn_t;

typedef map< string, PDTNode * > Name2Node_t;
typedef map< int, PDTNode * > Val2Node_t;
typedef map< string, PDTFunctionDec * > Name2Func_t;
typedef list< PDTFunctionCall * > UnresolvedFunc_t;
typedef multimap< string, PDTAssign * > Name2Assign_t;
typedef list< string > ScopeStack_t;

/*
 * function that handles resolving variable names
 */
string resolveName(string varName, ScopeStack_t & stack);

/*
 * function that checks whether variable exists
 */
PDTNode * checkName(string varName, ScopeStack_t & stack, Name2Node_t & name2node, bool & isFound); 

/**
 * function that updates a node's antlr properties
 */
void updateAntlrProps(PDTNode & node, PDTANTLRProp_t & prop_struct);

/**
 * function that create PDTANTLRProp_t
 */
PDTANTLRProp_t createAntlrProp(unsigned int line, int charPosition, long long start, long long stop);



#endif
